package com.trf.member.config;

import com.trf.member.filter.AuthenticationFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @author 小小唐
 * @Date 2023/3/8-星期三-19:17
 * 自定义配置类
 */
@Configuration
public class WebMVCConfig extends WebMvcConfigurationSupport {

    @Autowired
    private AuthenticationFilter authenticationFilter;

    @Override
    protected void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(authenticationFilter).
                //拦截所有请求
                addPathPatterns("/**").
                //登录请求排除，不被拦截
                excludePathPatterns("/user/login");
        super.addInterceptors(registry);
    }
}
